from tokenize import String

from sqlalchemy import create_engine, Column, Integer, DateTime
from sqlalchemy.dialects.mysql import pymysql
from sqlalchemy.orm import declarative_base, sessionmaker, synonym

SQLALCHEMY_DATABASE_URL = "sqlite:///./sql_app.db"

engine = create_engine(
    SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
)

Base = declarative_base()

SessionLocal = sessionmaker(bind=engine)


def get_db():
    db = SessionLocal()
    try:
        yield db
    finally:
        db.close()

